package tom.client.account;

import java.util.HashMap;

import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.ScrollPanel;

public class FormJournalMenu extends ScrollPanel implements ClickHandler {

	@Override
	public void onClick(ClickEvent event) {
		Button btn = ((Button) event.getSource());
		String bkCode = journal.get(btn.getText());
		String descript = btn.getText();
		Window.alert(bkCode + descript);
	}

	private static FormJournalMenu panel;

	public static FormJournalMenu getPanel() {
		if (panel == null) {
			panel = GWT.create(FormJournalMenu.class);
		}
		return panel;
	}

	private final FlexTable tab = new FlexTable();
	private final HashMap<String, String> journal = new HashMap<String, String>();

	public FormJournalMenu() {
		setStyleName("h1");
		setSize("800px", "500px");
		tab.setCellSpacing(20);
		setWidget(tab);
	}

}
